Skip to content

Conversation

@cima22
Copy link
Contributor

@cima22 cima22 commented Jan 20, 2026

Remove GPUDefParametersDefaults.h and generate GPU parameters using json file and CMake. Results checked with deterministic mode.

@github-actions
Copy link
Contributor

REQUEST FOR PRODUCTION RELEASES:
To request your PR to be included in production software, please add the corresponding labels called "async-" to your PR. Add the labels directly (if you have the permissions) or add a comment of the form (note that labels are separated by a ",")

+async-label <label1>, <label2>, !<label3> ...

This will add <label1> and <label2> and removes <label3>.

The following labels are available
async-2023-pbpb-apass4
async-2023-pp-apass4
async-2024-pp-apass1
async-2022-pp-apass7
async-2024-pp-cpass0
async-2024-PbPb-apass1
async-2024-ppRef-apass1
async-2024-PbPb-apass2
async-2023-PbPb-apass5

@cima22 cima22 force-pushed the json_param_definitions branch 2 times, most recently from 71b8e58 to 16e7fec Compare January 22, 2026 12:25
@cima22 cima22 force-pushed the json_param_definitions branch 2 times, most recently from 7ae23b1 to 174fcd4 Compare January 28, 2026 12:15
Copy link
Collaborator

@davidrohr davidrohr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, but perhaps you could implement some improvements.

elseif(backend STREQUAL "HIP") # HIP filter
set(TARGET_ARCH "${HIP_TARGET}" PARENT_SCOPE)
return()
else() # Return both
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you return both?
I would probably have a generic default target, which can be queried by "backend = default" explicitly, we could also set a default for opencl explicitly, and in case the backend does not match any known one, I would fail with message(FATAL_ERROR ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I return both s.t. the default parameters header has always both a CUDA or HIP fallback in case both backends are required to be compiled

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, now I think I understood how it works :).
Then I would call it "ALL", and export explicitly the defaults for all backends, including OpenCL.
And still fail in an else case for unknown backends.

function(set_target_cuda_arch target)
if(CUDA_COMPUTETARGET AND (CUDA_COMPUTETARGET MATCHES "86" OR CUDA_COMPUTETARGET MATCHES "89"))
function(detect_gpu_arch backend) # Detect GPU architecture, optionally filterring by backend
set(TARGET_ARCH "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since your if / else below covers all cases, I think there is no reason to initialize them to empty?

else()
set(TARGET_ARCH ${GPU_ARCH})
endif()
add_custom_command(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand, why you need to execute CMake explicitly on that cmake file [gpu_param_header_generator.cmake](https://github.com/AliceO2Group/AliceO2/pull/14972/changes#diff-69d48e46e923fe79aeab700a7a1ea6b0dc5b8d927a8493d8f449b168b52d50ba).
Couldn't you just include that cmake file, that would also execute it, or do I miss something?

Or better, I would put everything in that CMake file in a function, include that CMake file, and then just call the function.

file(APPEND "${TMP_HEADER}" "\n// Default parameters if not defined for the target architecture\n\n")
#Default parameters
foreach(TYPE IN LISTS TYPES)
# Get all keys of this TYPE as a semicolon-separated list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the copy&paste from the code above. Could you extract the duplicated part in a function?

…nerate GPU parameters using json file and CMake
@cima22 cima22 force-pushed the json_param_definitions branch from 174fcd4 to a97a95b Compare January 28, 2026 17:52
@cima22 cima22 force-pushed the json_param_definitions branch from a97a95b to b3b1c57 Compare January 28, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants